FROM ubuntu:20.04 as build
RUN export DEBIAN_FRONTEND=noninteractive &&\
        apt-get update && \
        apt-get install -y --no-install-recommends openjdk-11-jre build-essential \
        ca-certificates openssl telnet curl


COPY ./target/cloudrender-controller-*.jar /opt/sh/

RUN cd /opt/sh && \
        echo '#!/bin/bash' > run.sh && \
        echo 'cd /opt/sh' >> run.sh && \
        echo 'java  -jar cloudrender-controller-*.jar' >> run.sh && \
        chmod +x run.sh


FROM ubuntu:20.04
ENV LC_ALL zh_CN.UTF-8
RUN export DEBIAN_FRONTEND=noninteractive &&\
        apt-get update && \
        apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates language-pack-zh-hans telnet curl && \
        apt-get autoremove -y && \
        apt-get clean -y && \
        rm -rf /var/lib/apt/lists/*dic

COPY --from=build /opt /opt
WORKDIR /opt/sh
CMD ["sh", "run.sh"]
